#delimit;
clear;
capture log close;
set more off;

/*****local
CHANGE PATH
*****/;
local out "/data";
local pathtab "/data";

use "`out'/dataset_for_regs_new_RandR_noCB.dta", clear;

sort pid;
capture drop _merge;
merge m:1 pid using "`pathtab'/sector_homestate_noCB.dta";
drop _merge;
forvalues yo=21(1)40 {;
replace ever_with_pub4_`yo'_home=0 if ever_with_pub4_`yo'_home==.;
replace ever_with_pub2_`yo'_home=0 if ever_with_pub2_`yo'_home==.;
replace ever_with_priv_nfp4_`yo'_home=0 if ever_with_priv_nfp4_`yo'_home==.;
replace ever_with_priv_nfp2_`yo'_home=0 if ever_with_priv_nfp2_`yo'_home==.;
replace ever_with_priv_fp_`yo'_home=0 if ever_with_priv_fp_`yo'_home==.;
};

save "`out'/dataset_for_regs_new_RandR_homestate_noCB.dta", replace;

